﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 跳跃行为
/// </summary>
public class JumpAct : IAction
{


    public void MoveAct()
    {
        if(!mva.IsGround)
         if (Input.GetKey(KeyCode.D))
        {
            HoriMove(false);

        }
        else if (Input.GetKey(KeyCode.A))
        {
            HoriMove(true);
        }
    }

    public override void GetAction()
    {
        MoveAct();
        if (mva.IsHolding) return;
        if (!mva.IsGround) return;
        if (Input.GetKey(KeyCode.W))
            Jump();
    }

    public JumpAct(PlayerController pc) : base(pc) { }

    private void Jump()
    {
        rig.velocity = Vector3.up * mva.jumpVelocity;
    }
}
